<template>
  <svg v-if="name" aria-hidden="true" :style="{ width, height }"
       style="fill: currentColor;overflow: hidden;">
    <use :xlink:href="symbolId" />
  </svg>
</template>

<script setup lang="ts">
import { computed, defineProps } from 'vue'

const props = defineProps({
  prefix: {
    type: String,
    default: 'icon'
  },
  name: {
    type: String,
    required: true
  },
  width: {
    type: String,
    default: '1.5em'
  },
  height: {
    type: String,
    default: '1.5em'
  }
})

const symbolId = computed(() => `#${props.prefix}-${props.name}`)
</script>
